/*
 * BCAgent.h
 *
 *  Created on: 07/05/2013
 *      Author: agpardo
 */

#ifndef BCAGENT_H_
#define BCAGENT_H_

#include "Agents/RobotAgent.h"
#include "BirthClinic/include/BCAgentWorldModel.h"
#include "BirthClinic/include/BCGenotype.h"
#include "BirthClinic/include/BCSharedData.h"
#include "Coord2d.h"

class BCAgent : public RobotAgent, public boost::enable_shared_from_this<BCAgent>
{
public:
	BCAgent(World *__world, bool mainAgent_);

	virtual ~BCAgent();

	virtual void stepBehavior();

	virtual int genotypeSize();

    virtual BCAgentWorldModel* getWorldModel();
    virtual BCGenotype* getGenotype();
    virtual void initiateOrganism();
    virtual Coord2d getShift(int index_);
    virtual Coord2d getPosition();
    virtual bool isMainAgent();
    void buildGenotype();
    void buildGenotype(BCGenotype* parent1_, BCGenotype* parent2_);
    void printInfo();
    BCGene getGene(int index_);
    int getAge();
    void increaseAge();
    int getId();
    LifeCycleState getState();
    bool hasDied();
    void setDie();
    void addComponent(int compId_);
    std::vector<int> getComponents();
    int getSensorValue(int sensorId_);
    void startCooldownPeriod();
    bool canReproduce();
    int getSize();

    int evaluate();

    int getConstructionPeriod();

private:
    int _maxAge;
    int _currentAge;
    int _infancy;
	BCGenotype* _genotype;
	bool _mainAgent;
	int _postnatalCounter;
	int _constructionPeriod;

	std::vector<int> _components;

	LifeCycleState _state;

};

typedef boost::shared_ptr<BCAgent> BCAgentPtr;

#endif /* BCAGENT_H_ */
